var bgmusic=function(arguments){

//	音乐初始化

	console.log("bgmusic")

	var timestamp = parseInt(Date.parse(new Date())/10000);

	var FileFolder="sound/"

	var soundUrl="bgm.mp3?v=124";

	var music_dom=$("<div class='music_p rotate' id='music'></div>");

	var audio_dom=$("<audio class='mp3' src='"+FileFolder+soundUrl+"' autoplay='autoplay' id='audio_mp3'></audio>")

			

//	var audio_dom=$("#audio_mp3");

	$(document.body).append(music_dom);

	$(document.body).append(audio_dom);

//		console.log(music_dom);

		

	$("#music").click(function(){	

		if($("#music").is($(".rotate"))){

			$("#music").css({background:"url("+FileFolder+"musicClose.png) no-repeat center 100%/100%"});

			$("#music").removeClass("rotate");

			$("#audio_mp3").trigger('pause');

		}

		else{

			$("#music").css({background:"url("+FileFolder+"musicOpen.png) no-repeat center 100%/100%"});

			$("#music").addClass("rotate");

			$("#audio_mp3").trigger('play');

		}

	});

	

	var mmp3=document.querySelector("#audio_mp3")

	document.addEventListener('DOMContentLoaded',audioAutoPlay);

	mmp3.onended=function(){

		mmp3.load();

		mmp3.play();

	}

	function audioAutoPlay()

	{

		document.addEventListener("WeixinJSBridgeReady", function () {

		mmp3.play();

		}, false);	

	}

	this.setSoundUrl=function (url)

	{

		soundUrl=url

		audio_dom.attr("src",FileFolder+url)

		console.log(soundUrl);

	}

	this.aa=function (){

		console.log(7777);

	}

	this.setSoundUrl("bgm.mp3?v="+timestamp)

	//this.soundUrl=soundUrl

	//this.soundUrl=soundUrl(url) 

	

}

